<?php
/**
 * The template for displaying Post Format pages
 *
 * Used to display archive-type pages for posts with a post format.
 * If you'd like to further customize these Post Format views, you may create a
 * new template file for each specific one.
 *
 * @todo http://core.trac.wordpress.org/ticket/23257: Add plural versions of Post Format strings
 * and remove plurals below.
 *
 * @link http://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Fourteen
 * @since Twenty Fourteen 1.0
 */

get_header(); 


global $woo_options, $wp_query;
//$current_cat = get_term_by("slug",$wp_query->query_vars['term'], $wp_query->query_vars['taxonomy']);

//other get term
//$terms = wp_get_object_terms($post->ID,"categories");
//list($child) = get_terms($terms->taxonomy);

//ok, get list of term
 // $terms = get_terms("categories","parent=0"); //&hide_empty=0
// var_dump($terms);

//ok, get definetly taxonomy
//$the_tax = get_taxonomy( get_query_var( 'taxonomy' ) );

//ok, $the_term = get_term( get_query_var( 'term' ) );
//$the_term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );

$strTaxonomyCurrent = get_query_var( 'taxonomy' );
$strTermCurrent = get_query_var( 'term' );


?>

	<section id="primary" class="content-area">
		<div id="content" class="site-content" role="main">
			<h1 class="archive-title">
				<?php //$terms->name;
				echo get_link_to_last_term($strTermCurrent, $strTaxonomyCurrent);
				
				
				$loop = 1;
				$query = array(
				  'post_type' => 'san-pham',
				  'orderby' => 'date',
				  'order' => 'desc',
				  'posts_per_page' => 5,
				  'status' => 'publish',
				  'tax_query' => array(
					  array(
						  'taxonomy' => 'categories',
						  'field' => 'slug',
						  'terms' => get_query_var("categories")
					  )
				  )
				);
				
				var_dump("categories === ".get_query_var("categories"));
				?>
				
				<div class="divlist_goods">
					<?php
					//loop for getting posts...
					$the_query = new WP_Query($query);
					while($the_query->have_posts())
					{
						$the_query->the_post();
						get_template_part("template","goods-box");
						$loop++;
					}
					?>
				</div>

				<h1/>
				
				<?php
				var_dump($loop);
				?>
			</h1>
				
<a href="http://codex.wordpress.org/Template_Hierarchy">LinkAAA</a>
		
		</div>
	</section>



<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();
